﻿package
{
	import flash.display.MovieClip;
	import flash.text.TextField;
	import com.bizmlib.ui.composite.UICompositionItem;
	
	
	public class TestUICompositionItem extends UICompositionItem
	{
		private var graphix:MovieClip;
		private var tf:TextField;
		
		private var itemText:String;
		
		
		public function TestUICompositionItem()
		{
		}
		
		
		
		override protected function afterInit():void
		{
			stop();
			
			areaClass = UICompositionItemArea;
			
			graphix = getChildByName("graphixMC") as MovieClip;
			tf = getChildByName("mainTF") as TextField;
			tf.visible = false;
		}
		
		override protected function afterUpdate():void
		{
			//trace(this + ".afterUpdate(" + arguments + ")");
			
			tf.text = dataProvider ? dataProvider.name : "";
		}
		
		override protected function setShowCompleteDelay(delay:Number = 0):void
		{
			super.setShowCompleteDelay(100);
		}
		override protected function setHideCompleteDelay(delay:Number = 0):void
		{
			super.setHideCompleteDelay(60);
		}
		
		override protected function drawShow():void
		{
			//trace(this + ".drawShow(" + arguments + ")");
			
			tf.visible = true;
			gotoAndPlay("show");
		}
		override protected function drawHide():void
		{
			//trace(this + ".drawHide(" + arguments + ")");
			
			tf.visible = false;
			gotoAndPlay("hide");
		}
		override protected function drawPress(exceptionallCall:Boolean):void
		{
			//trace(this + ".drawPress(" + arguments + ")");
			graphix.gotoAndPlay("press");
		}
		override protected function drawRollOver(exceptionalCall:Boolean):void
		{
			//trace(this + ".drawRollOver(" + arguments + ")");
			graphix.gotoAndPlay("over");
		}
		override protected function drawRollOut(exceptionalCall:Boolean):void
		{
			//trace(this + ".drawRollOut(" + arguments + ")");
			graphix.gotoAndPlay("out");
		}
	}
}